<template>
  <div id="pager">
    <router-view v-if="$store.state.isSignIn" />
    <van-overlay
      duration="0.1"
      style="background:rgba(0,0,0,0.3);z-index: 100000"
      :show="$store.state.loadingShow"
    >
      <div id="loading">
        <img src="./assets/img/loading/loading.gif" alt />
        <div style="text-align: center;font-size: 12px">
          正在加载中...
        </div>
      </div>
    </van-overlay>
    <van-number-keyboard safe-area-inset-bottom />
  </div>
</template>

<script setup>
import {getCurrentInstance, onMounted, reactive} from "vue";
import { memberIdToLogin, getConfigureInfo } from "./ajaxs/index";

const { proxy } = getCurrentInstance();
const init = () => {
  // 开发模式
  // localStorage.memberId = "E3005491A5EC09B345C"; // 李宁
  // localStorage.memberId = "32E4D04D80E79890F40"; // 测试王佳
  // localStorage.memberId = "067BE1779768950003D"; // 杨朝国
  localStorage.memberId = "5FE79E120AF0B0A6A79"; // 张志业
  // localStorage.memberId = "61F475576C0193C67D5"; // 白宇
  // localStorage.memberId = "2A106A6729CC60418CF"; // 任大江
  setTimeout(async () => {
    if (proxy.$route.query.member_id) {
      localStorage.setItem("memberId", proxy.$route.query.member_id);
    }
    sessionStorage.setItem("isNative", proxy.$route.query.isNative);
    await memberIdToLogin();
    await getConfigureInfo();
  }, 500);
};

onMounted(() => {
  init();
});
</script>

<style lang="less" scoped>
#pager {
  height: 100%;
  :deep(.van-overlay) {
    z-index: 1000;
  }
  background: #f3f4f5;
}

#loading {
  text-align: center;
  margin-top: -40px;
  padding: 12px 0;
  width: 90px;
  background: white;
  border-radius: 5px;
  img {
    width: 46px;
  }
  .center();
}
</style>
